<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>充值</title>
		<meta name="Keywords" content="">
		<meta name="Description" content="">
		{include file="book@web_public/head_static" /}
		<link href="__WEB__css/member.css" rel="stylesheet" />
	</head>
	<body>
		{include file="book@member/public/head" /}
		<div class="content">
			<div class="container">
				<div id="topup-page" class="clearfix">
					{include file="book@member/public/left_nav" /}
					<div id="member-main" class="pull-right">
						<div class="mm-box-style1 clearfix" style="min-height: 450px;">
							<div class="tp-title-1">充值方式</div>
							<div class="pay-list">
								<dl>
									<dd class="pl-method" data-method="alipay">
										<p class="icon alipay"></p>
										<p class="title">支付宝</p>
										<cite></cite>
									</dd>
									<dd class="pl-method" data-method="weixin">
										<p class="icon weixin"></p>
										<p class="title">微信</p>
										<cite></cite>
									</dd>
								</dl>
							</div>
							<div class="tp-title-1">充值金额<span>兑换率：{$Think.config.mn_book.money_unit_price}{$Think.config.mn_book.money_name} = {$Think.config.mn_book.read_money_exchange_rate}{$Think.config.mn_book.read_money_name}</span></div>
							<div class="money-list">
								<dl>
									<dd class="" data-amount="10">
										<p class="ml-amount">￥10</p>
										<span class="ml-score">(赠<i>1000</i>{$Think.config.mn_book.read_money_name})</span>
										<cite></cite>
									</dd>
									<dd class="" data-amount="20">
										<p class="ml-amount">￥20</p>
										<span class="ml-score">(赠<i>2000</i>{$Think.config.mn_book.read_money_name})</span>
										<cite></cite>
									</dd>
									<dd class="" data-amount="30">
										<p class="ml-amount">￥30</p>
										<span class="ml-score">(赠<i>3000</i>{$Think.config.mn_book.read_money_name})</span>
										<cite></cite>
									</dd>
									<dd class="" data-amount="50">
										<p class="ml-amount">￥50</p>
										<span class="ml-score">(赠<i>5000</i>{$Think.config.mn_book.read_money_name})</span>
										<cite></cite>
									</dd>
									<dd class="" data-amount="100">
										<p class="ml-amount">￥100</p>
										<span class="ml-score">(赠<i>10000</i>{$Think.config.mn_book.read_money_name})</span>
										<cite></cite>
									</dd>
									<dd class="custom" data-amount="0">
										<span class="ml-score">其它金额</span>
										<p class="ml-amount">￥<input type="text" placeholder="输入金额" maxlength="5"></p>
										<span class="ml-score">(<i>0</i>{$Think.config.mn_book.read_money_name})</span>
										<cite></cite>
									</dd>
								</dl>
							</div>
							<div class="pay-btn mt10"><a href="javascript:;" class="do-submit">立即支付 ￥<span>0</span></a></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		{include file="book@web_public/foot" /}
		<script>
			$(function(){
				// 设置默认支付类型与金额
				$('.pay-list dl dd:first').addClass('active');
				$('.money-list dl dd:first').addClass('active');
				$('.do-submit span').html($('.money-list dl dd:first').data('amount'));

				// 切换充值方式
				$('.pay-list dl dd').click(function(){
					$('.pay-list dl dd').removeClass('active');
					$(this).addClass('active');
				});

				// 切换充值金额
				$('.money-list dl dd').click(function(){
					$('.do-submit span').html($(this).data('amount'));
					$('.money-list dl dd').removeClass('active');
					$(this).addClass('active');
				});
				// 充值提交
				$('.do-submit').click(function(){
					var amount = $('.money-list dl dd.active').data('amount');
					if(amount < 1 || parseInt(amount) != amount){
						alert('充值金额必须是1的整数倍！');
						return false;
					}
					$payment_url = '/payment/type/'+$('.pay-list dl dd.active').data('method')+'/amount/'+$('.money-list dl dd.active').data('amount')+'.{$Think.config.url_html_suffix}';
					// window.location.href = $payment_url;
					window.open($payment_url);
				});
				// 输入金额时
				$('.money-list dl dd input').bind('input propertychange',function(){
					var amount = $(this).val();
					$('.do-submit span').html(amount);
					$('.money-list dl dd.custom .ml-score i').html(amount*100);
					$('.money-list dl dd.custom').data('amount',amount);
				});
			});
		</script>
	</body>
</html>